<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    var maxAscendingSum = function (nums) {
      let res = 0;
      let l = 0;
      while (l < nums.length) {
        let cursum = nums[l++];
        while (l < nums.length && nums[l] > nums[l - 1]) {
          cursum += nums[l++];
        }
        res = Math.max(res, cursum);
      }
      return res;
    };
    console.log(maxAscendingSum(nums = [10, 20, 30, 5, 10, 50]))
  </script>
</body>

</html>